package top.hg.tool.modules.common.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import top.hg.tool.common.util.NumberParser;
import top.hg.tool.common.util.R;

/**
 * @Author: skh
 * @Date: 2019/6/11 14:24
 * @Description:
 */
@RestController
@Slf4j
public class ToolController {

    ////将数字转化为英文金额
    //@GetMapping("/parseNumber/{number}")
    //public R parserNumber(@PathVariable String number) {
    //    log.info("金额转换,数字:[{}]", number);
    //    String result = NumberParser.parse(number);
    //    result = result.toUpperCase();
    //    return R.success(result);
    //}

    //执行小数转为英文
    @GetMapping("/parseNumber")
    public R parserNumber2(String number) {
        log.info("金额转换,数字:[{}]", number);
        String result = NumberParser.parse(number);
        result = result.toUpperCase();
        return R.success(result);
    }

    //将数字转化为英文金额
    @GetMapping("/")
    public R test() {
        return R.success("成功");
    }
}
